package com.beeantec.jnrerc.modules.news.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.beeantec.jnrerc.core.api.dto.PagingReqDTO;
import com.beeantec.jnrerc.dto.CourseDTO;
import com.beeantec.jnrerc.entity.News;
import com.beeantec.jnrerc.mapper.NewsMapper;
import com.beeantec.jnrerc.modules.news.service.NewsService;
import org.springframework.stereotype.Service;


@Service
public class NewsServiceImpl extends ServiceImpl<NewsMapper, News> implements NewsService {
    @Override
    public IPage<News> paging(PagingReqDTO<News> reqDTO) {
        //创建分页对象
        Page page = new Page(reqDTO.getCurrent(), reqDTO.getSize());
        //转换结果
        IPage<News> pageData = baseMapper.paging(page, reqDTO.getParams());
        return pageData;
    }

    @Override
    public News info(Long newsId) {
        return baseMapper.selectById(newsId);
    }
}
